
/*
 *@author <a href="mailto:PaBuDr@googlemail.com">N.N.</a>
 *@version $Revision:  $
 *
 *Last update: $Date:  $
 *by:          $Author: Hendric Butz, Markus Paff, Kevin Drzycimski $
*/
package pabudr_se;


import java.awt.Color;
import java.awt.geom.Ellipse2D;
import java.io.Serializable;

public class Atom extends Ellipse2D.Float implements Serializable {

        // Default Farbe von Atomen
       public final static Color DEFAULTCOLOR = Color.BLUE;


       public final static float SLOWFACTOR = 0.1f;
	/**
	 *
	 */
	private static final long serialVersionUID = 3897310611080120776L;

	/**
	 * Die Geschwindigkeit in x-Richtung
	 */
	float vx;

	/**
	 * Die Geschwindigkeit in y-Richtung
	 */
	float vy;

	/**
	 * Die Masse des Atoms
	 */
	float masse;

	/**
	 * Der Radius dieses Atoms
	 */
	float radius;

	/**
	 * Die Farbe des Atoms
	 */
	Color farbe;

	/**
	 * Ist dieses Atom markiert?
	 */
	boolean isMarked = false;

        /**
         * Name des Atoms
         */
        String name;

        /**
         * Id des Atoms
         */
        int id;

        /**
	 *
	 * @param x
	 * @param y
	 * @param vx
	 * @param vy
	 * @param masse
	 * @param radius
	 * @param farbe
	 */
	public Atom(float x, float y, float vx, float vy, float masse,
			float radius, Color farbe) {
		super(x-radius, y-radius, radius*2, radius*2);
		this.vx = vx;
		this.vy = vy;
		this.masse = masse;
		this.radius = radius;
		this.farbe = farbe;

	}

        public Atom(int id, String name, float radius, float masse){
            this.id=id;
            this.name=name;
            this.radius=radius;
            this.masse=masse;
        }

        public final Vector2 getPosiVector()
        {
            return new Vector2(this.getfX(), this.getfY());
        }

        /**
         * Vektor der Geschwindigkeitsrichtung
         * @return
         */
        public final Vector2 getVelVector()
        {
            return new Vector2(this.vx, this.vy);
        }
	/**
	 * Bewegt das Atom entlang seines Geschwindigkeitsvektors
	 */
	public final void move() {
		x += vx*SLOWFACTOR;
		y += vy*SLOWFACTOR;
	}

	public final float getfX() {
		return (float)super.getCenterX();
	}

	public final float getfY() {
		return (float)super.getCenterY();
	}

	public final void setVx(float vx) {
		this.vx = vx;
	}

	public final void setVy(float vy) {
		this.vy = vy;
	}

	public final float getVx() {
		return vx;
	}

	public final float getVy() {
		return vy;
	}

	public final float getMasse() {
		return masse;
	}

	public final float getRadius() {
		return radius;
	}

	public final Color getFarbe() {
		return farbe;
	}

        public final void setName(String name) {
                this.name = name;
        }

        public final String getName() {
                return name;
        }

        public final void setId(int id) {
                this.id = id;
        }

        public final int getId() {
                return id;
        }



}
